﻿<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<style type="text/css">
.main-cont-body {
	height: 100%
}
</style>
<script type="text/javascript">
	var knowledgeCategoryTree_Onclick = function(event, treeId, treeNode) {

		var keyword = isperp.getWindow("knowledgeSearchIframe").getKeyword();

		$("#knowledgeSearchIframe").prop("src", "knowledge/knowledgeSearch/searchResultView?categoryId=" + treeNode.id + "&keyword=" + keyword);

	};

	function iFrameHeight() {
		var ifm = document.getElementById("knowledgeSearchIframe");
		var subWeb = document.frames ? document.frames["knowledgeSearchIframe"].document : ifm.contentDocument;
		if (ifm != null && subWeb != null) {
			$("#knowledgeSearchIframe").height(subWeb.body.scrollHeight + 10);
		}

	}
</script>

<section class="frame-main" style="height: 100%;">

	<div id="dvFrameMainNav" class="frame-main-nav" style="height: 100%">
		<isperp:tree id="knowledgeCategoryTree" title="知识分类">
			<isperp:async enable="true" url="knowledge/knowledgeCategory/getTree">
			</isperp:async>
			<isperp:callback onClick="knowledgeCategoryTree_Onclick">
			</isperp:callback>
		</isperp:tree>
	</div>
	<section id="mainContent" class="frame-main-cont frame-main-cont-first"
		role="main" style="top:0;height: 100%">
		<div id="dvContainer">
			<iframe id="knowledgeSearchIframe" onload="iFrameHeight()"
				src="knowledge/knowledgeSearch/searchResultView"
				style="width:76%;height:100%;border:none;position: absolute;">
			</iframe>
			<div class="box n-box"
				style="float:left;width: 24%;right: 0;position: absolute;">
				<div class="box ">
					<div class="header">
						<h2>热门知识Top10</h2>
					</div>
					<ul class="lists">
						<c:forEach items="${warmTop10Entities}" var="warmEntiry">
							<li class="nui-txt-link"
								onclick="knowledgeInfoView('${warmEntiry.id}')">${warmEntiry.title}</li>
						</c:forEach>
					</ul>


				</div>
				<div class="box n-box" style="margin-top:5px">

					<div class="header">
						<h2>最新知识Top10</h2>
					</div>
					<ul class="lists">
						<c:forEach items="${newTop10Entities}" var="newEntity">
							<li class="nui-txt-link"
								onclick="knowledgeInfoView('${newEntity.id}')">${newEntity.title}</li>
						</c:forEach>
					</ul>


				</div>
				<div class="box n-box" style="margin-top:5px">


					<div class="header">
						<h2>我的收藏夹</h2>
					</div>
					<ul class="lists">
						<c:forEach items="${myFavoriteEntities}" var="favoriteEntity">
							<li class="nui-txt-link"
								onclick="knowledgeInfoView('${favoriteEntity.id}')">${favoriteEntity.title}</li>
						</c:forEach>
					</ul>


				</div>
			</div>
		</div>
	</section>
</section>
<script type="text/javascript">
	function knowledgeInfoView(id) {
		var tempTitle = "知识详情";
		var tempUrl = "knowledge/knowledgeSearch/knowledgeInfoView?id=" + id;
		var options = {
			title : tempTitle,
			contentUrl : tempUrl
		};
		isperp.openDialog(options);
	}

	$("#knowledgeSearchIframe").height($(window).height() - 20);
</script>
